package com.jake.xpage.page;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.LinkedList;

public interface XPageManger {

    void push(XPage page, IPageAnimator animator);

    void pop(IPageAnimator animator);

    void popTo(XPage page, IPageAnimator animator);

    XPage peek();

    XPage peekSecond();

    void remove(int pageIndex);

    void remove(XPage page);

    @NonNull
    LinkedList<XPage> getAllPages();

    void addOnPagesChangedListener(OnPagesChangedListener listener);

    void removeOnPagesChangedListener(OnPagesChangedListener listener);

    public interface OnPagesChangedListener {
        int EVENT_BEFORE_PUSH = 1;
        int EVENT_AFTER_PUSH = 2;
        int EVENT_BEFORE_POP = 3;
        int EVENT_AFTER_POP = 4;
        int EVENT_BEFORE_REMOVE = 5;
        int EVENT_AFTER_REMOVE = 6;

        void onChanged(int event, @Nullable XPage currentPage, @Nullable XPage targetPage);
    }
}
